/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Menu.java
 *
 * Created on Nov 12, 2011, 2:50:42 AM
 */
package Boundary;

//import Boundary.tambahMember;
//import Bunderi.kelolaMember;
import Boundary.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

/**
 *
 * @author Yudi
 */
public class Home extends javax.swing.JFrame {

    ImageIcon icon = new ImageIcon(getClass().getResource("/gambar/pesanMenu.png"));
    ImageIcon iconMemberHover = new ImageIcon(getClass().getResource("/gambar/memberIconHover.png"));
    /** Creates new form Menu */
    Dimension dimensi = Toolkit.getDefaultToolkit().getScreenSize();
    int sizeWidth = 960;
    int sizeHeigth = 560;
    int locX = (dimensi.width - sizeWidth) / 2;
    int locY = (dimensi.height - sizeHeigth) / 2;
    public static JPanel panelActive;

    public Home() {
        Dimension dim = getToolkit().getScreenSize();

        setPanelActive(panelHome);

        this.setLocation(locX, locY);
        this.setSize(sizeWidth, sizeHeigth);
        requestFocus();

        this.setBackground(Color.getHSBColor(0, 102, 204));

        initComponents();
        this.setResizable(false);
        this.setTitle("Sebar INFO versi 1.69 Acak-acakan");
    }

    public static void tampilFrameTambah() {
        getPanelActive().setVisible(false);
        PanelTambahMember panelTambahMember = new PanelTambahMember();
        panelConten.add(panelTambahMember);
        setPanelActive(panelTambahMember);
        panelTambahMember.setVisible(true);


    }

    private void tampilFrameCekKonfirmasi() {
        getPanelActive().setVisible(false);
        PanelCekKonfirmasi panelCekKonfirmasi = new PanelCekKonfirmasi();
        panelConten.add(panelCekKonfirmasi);
        setPanelActive(panelCekKonfirmasi);
        panelCekKonfirmasi.setVisible(true);
        panelCekKonfirmasi.showTabelPesan();

    }
    public static void tampilFramePesan() {
        getPanelActive().setVisible(false);
        PanelKirimPesan panelPesan = new PanelKirimPesan();
        setPanelActive(panelPesan);
        panelConten.add(panelPesan);
        panelPesan.setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelMain = new javax.swing.JPanel();
        panelConten = new javax.swing.JPanel();
        panelHome = new javax.swing.JPanel();
        labelMember = new javax.swing.JLabel();
        labelCekKonfirmasi = new javax.swing.JLabel();
        labelPesan = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        menuMain = new javax.swing.JMenu();
        menuKelolaMember = new javax.swing.JMenu();
        submenuTambahMember = new javax.swing.JMenuItem();
        submenuEdit = new javax.swing.JMenuItem();
        menuKirimPesan = new javax.swing.JMenuItem();
        menuCekKonfirmasi = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        menuExit = new javax.swing.JMenuItem();
        menuHelp = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        jMenuItem2 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setIconImage(icon.getImage());
        setMinimumSize(new java.awt.Dimension(960, 540));
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        panelMain.setBackground(new java.awt.Color(0, 102, 204));
        panelMain.setMaximumSize(new java.awt.Dimension(960, 540));
        panelMain.setMinimumSize(new java.awt.Dimension(960, 540));
        panelMain.setPreferredSize(new java.awt.Dimension(960, 540));
        panelMain.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        panelConten.setBackground(new java.awt.Color(0, 102, 255));
        panelConten.setAlignmentX(0.0F);
        panelConten.setAlignmentY(0.0F);
        panelConten.setMaximumSize(new java.awt.Dimension(960, 540));
        panelConten.setMinimumSize(new java.awt.Dimension(960, 540));
        panelConten.setPreferredSize(new java.awt.Dimension(960, 540));

        panelHome.setBackground(new java.awt.Color(51, 153, 255));
        panelHome.setMaximumSize(new java.awt.Dimension(960, 540));
        panelHome.setMinimumSize(new java.awt.Dimension(960, 540));
        panelHome.setName("panelHome"); // NOI18N
        panelHome.setPreferredSize(new java.awt.Dimension(960, 540));
        panelHome.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        labelMember.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/memberIcon.png"))); // NOI18N
        labelMember.setLabelFor(panelHome);
        labelMember.setToolTipText("Klik untuk melihat member");
        labelMember.setName("labelMember"); // NOI18N
        labelMember.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                labelMemberMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                labelMemberMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                labelMemberMouseExited(evt);
            }
        });
        panelHome.add(labelMember, new org.netbeans.lib.awtextra.AbsoluteConstraints(680, 160, -1, -1));

        labelCekKonfirmasi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/cekKonfirmasiIcon.png"))); // NOI18N
        labelCekKonfirmasi.setLabelFor(panelHome);
        labelCekKonfirmasi.setToolTipText("Klik untuk melihat konfirmasi");
        labelCekKonfirmasi.setName("labelCekKonfirmasi"); // NOI18N
        labelCekKonfirmasi.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                labelCekKonfirmasiMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                labelCekKonfirmasiMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                labelCekKonfirmasiMouseExited(evt);
            }
        });
        panelHome.add(labelCekKonfirmasi, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 160, -1, -1));

        labelPesan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/pesanIcon.png"))); // NOI18N
        labelPesan.setLabelFor(panelHome);
        labelPesan.setToolTipText("klik untuk mengirim pesan");
        labelPesan.setName("labelPesan"); // NOI18N
        labelPesan.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                labelPesanMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                labelPesanMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                labelPesanMouseExited(evt);
            }
        });
        panelHome.add(labelPesan, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 160, -1, -1));

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/bg.jpg"))); // NOI18N
        jLabel2.setLabelFor(panelHome);
        jLabel2.setAlignmentY(0.0F);
        panelHome.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 960, 540));

        panelConten.add(panelHome);
        panelHome.getAccessibleContext().setAccessibleParent(panelHome);

        panelMain.add(panelConten, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 960, 540));

        getContentPane().add(panelMain, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 960, 550));

        menuMain.setText("Menu");

        menuKelolaMember.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/memberMenu.png"))); // NOI18N
        menuKelolaMember.setText("Kelola Member");

        submenuTambahMember.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK));
        submenuTambahMember.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/tambahMenu.png"))); // NOI18N
        submenuTambahMember.setText("Tambah Member");
        submenuTambahMember.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submenuTambahMemberActionPerformed(evt);
            }
        });
        menuKelolaMember.add(submenuTambahMember);

        submenuEdit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.ALT_MASK));
        submenuEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/editMenu.png"))); // NOI18N
        submenuEdit.setText("Edit");
        submenuEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submenuEditActionPerformed(evt);
            }
        });
        menuKelolaMember.add(submenuEdit);

        menuMain.add(menuKelolaMember);

        menuKirimPesan.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
        menuKirimPesan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/pesanMenu.png"))); // NOI18N
        menuKirimPesan.setText("Kirim Pesan");
        menuKirimPesan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuKirimPesanActionPerformed(evt);
            }
        });
        menuMain.add(menuKirimPesan);

        menuCekKonfirmasi.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_K, java.awt.event.InputEvent.ALT_MASK));
        menuCekKonfirmasi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/cekMenu.png"))); // NOI18N
        menuCekKonfirmasi.setText("Cek Konfirmasi");
        menuCekKonfirmasi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuCekKonfirmasiActionPerformed(evt);
            }
        });
        menuMain.add(menuCekKonfirmasi);
        menuMain.add(jSeparator1);

        menuExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        menuExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/exit.png"))); // NOI18N
        menuExit.setText("Exit");
        menuExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuExitActionPerformed(evt);
            }
        });
        menuMain.add(menuExit);

        jMenuBar1.add(menuMain);

        menuHelp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/helpMenu.png"))); // NOI18N
        menuHelp.setText("Help");

        jMenuItem1.setText("Petunjuk Penggunaan");
        menuHelp.add(jMenuItem1);
        menuHelp.add(jSeparator2);

        jMenuItem2.setText("Tentang Kami");
        menuHelp.add(jMenuItem2);

        jMenuBar1.add(menuHelp);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void submenuTambahMemberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submenuTambahMemberActionPerformed
        tampilFrameTambah();        // TODO add your handling code here:
}//GEN-LAST:event_submenuTambahMemberActionPerformed

    private void submenuEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submenuEditActionPerformed
        getPanelActive().setVisible(false);
        PanelEditMember edit = new PanelEditMember(getPanelActive());
        setPanelActive(edit);
        panelConten.add(edit);
        edit.showTabel();
        edit.setVisible(true);// TODO add your handling code here:
}//GEN-LAST:event_submenuEditActionPerformed

    private void menuKirimPesanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuKirimPesanActionPerformed
        tampilFramePesan();
}//GEN-LAST:event_menuKirimPesanActionPerformed

    private void labelPesanMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelPesanMouseClicked
        tampilFramePesan();
    }//GEN-LAST:event_labelPesanMouseClicked

    private void labelCekKonfirmasiMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelCekKonfirmasiMouseClicked
        tampilFrameCekKonfirmasi();
       
    }//GEN-LAST:event_labelCekKonfirmasiMouseClicked

    private void labelMemberMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelMemberMouseClicked
        getPanelActive().setVisible(false);

        PanelEditMember edit = new PanelEditMember(getPanelActive());
        setPanelActive(edit);
        panelConten.add(edit);

        edit.setVisible(true);
        edit.showTabel();
    }//GEN-LAST:event_labelMemberMouseClicked

    private void menuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuExitActionPerformed
        this.setVisible(false);
        Login login = new Login();
        login.setVisible(true);// TODO add your handling code here:
    }//GEN-LAST:event_menuExitActionPerformed

    private void labelPesanMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelPesanMouseEntered
        labelPesan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/pesanIconHover.png")));
    }//GEN-LAST:event_labelPesanMouseEntered

    private void labelMemberMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelMemberMouseEntered
        labelMember.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/memberIconHover.png")));       // TODO add your handling code here:
    }//GEN-LAST:event_labelMemberMouseEntered

    private void labelMemberMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelMemberMouseExited
        labelMember.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/memberIcon.png")));    // TODO add your handling code here:
    }//GEN-LAST:event_labelMemberMouseExited

    private void labelPesanMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelPesanMouseExited
        labelPesan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/pesanIcon.png")));
    }//GEN-LAST:event_labelPesanMouseExited

    private void labelCekKonfirmasiMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelCekKonfirmasiMouseEntered
        labelCekKonfirmasi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/cekKonfirmasiIconHover.png")));
    }//GEN-LAST:event_labelCekKonfirmasiMouseEntered

    private void labelCekKonfirmasiMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelCekKonfirmasiMouseExited
        labelCekKonfirmasi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/cekKonfirmasiIcon.png")));        // TODO add your handling code here:
    }//GEN-LAST:event_labelCekKonfirmasiMouseExited

    private void menuCekKonfirmasiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCekKonfirmasiActionPerformed
        tampilFrameCekKonfirmasi();        // TODO add your handling code here:
    }//GEN-LAST:event_menuCekKonfirmasiActionPerformed

    public static JPanel getPanelConten() {
        return panelConten;
    }

    public void showPenelHome() {


        panelHome.setVisible(true);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            @SuppressWarnings("static-access")
            public void run() {
                Home home = new Home();
                home.setVisible(true);
                home.setPanelActive(panelHome);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JLabel labelCekKonfirmasi;
    private javax.swing.JLabel labelMember;
    private javax.swing.JLabel labelPesan;
    private javax.swing.JMenuItem menuCekKonfirmasi;
    private javax.swing.JMenuItem menuExit;
    private javax.swing.JMenu menuHelp;
    private javax.swing.JMenu menuKelolaMember;
    private javax.swing.JMenuItem menuKirimPesan;
    private javax.swing.JMenu menuMain;
    private static javax.swing.JPanel panelConten;
    public static javax.swing.JPanel panelHome;
    private javax.swing.JPanel panelMain;
    private javax.swing.JMenuItem submenuEdit;
    private javax.swing.JMenuItem submenuTambahMember;
    // End of variables declaration//GEN-END:variables
    public static JPanel getPanelActive() {
        return panelActive;
    }

    public static void setPanelActive(JPanel panelActive2) {
        panelActive = panelActive2;
    }
}
